#include "..\headers\ListOf.h"

typedef struct LNodeList {
  int data;
  struct LNodeList *next;
} LNodeList, *LinkList;

void freeList(LinkList head) {
  LinkList temp;
  while (head) {
    temp = head;
    head = head->next;
    free(temp);
  }
}

// head insert
LinkList CreatList() {
  LinkList head, p1 = NULL;
  int f;
  head = (LinkList)malloc(sizeof(LNodeList));
  if (head == NULL) {
    freeList(head);
    return NULL;
  }
  head->next = NULL;
  p1 = head->next;

  while (1) {
    scanf("%d", &f);
    if (f < 0) break;
    p1 = (LinkList)malloc(sizeof(LNodeList));
    if (p1 == NULL) {
      freeList(head);
      return NULL;
    }
    p1->data = f;
    p1->next = head->next;
    head->next = p1;
  }
  return head;
}

int main() {
  LinkList head, p;
  int n;
  scanf("%d", &n);
  head = CreatList();
  p = head->next;

  for (int i = 1; i < n; i++) p = p->next;

  if (p != NULL)
    printf("%d", p->data);
  else
    printf("NULL");
  freeList(head);
}
